import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 考试题库信息 */
export interface Questions {
          id: number; // 题目ID
          grade: string; // 年级
          subject: string; // 学科
          source?: string; // 来源
          questionType?: string; // 题型
          questionContent: string; // 题目
          standardAnswer: string; // 答案
          answerAnalysis: string; // 答案解析
          scoringCriteria: string; // 评分标准
          knowledgePoints: string; // 知识点
          difficultyLevel: number; // 难度等级(1-5)
  }

// 考试题库 API
export const QuestionsApi = {
  // 查询考试题库分页
  getQuestionsPage: async (params: any) => {
    return await request.get({ url: `/exam/questions/page`, params })
  },

  // 查询考试题库详情
  getQuestions: async (id: number) => {
    return await request.get({ url: `/exam/questions/get?id=` + id })
  },

  // 新增考试题库
  createQuestions: async (data: Questions) => {
    return await request.post({ url: `/exam/questions/create`, data })
  },

  // 修改考试题库
  updateQuestions: async (data: Questions) => {
    return await request.put({ url: `/exam/questions/update`, data })
  },

  // 删除考试题库
  deleteQuestions: async (id: number) => {
    return await request.delete({ url: `/exam/questions/delete?id=` + id })
  },

  /** 批量删除考试题库 */
  deleteQuestionsList: async (ids: number[]) => {
    return await request.delete({ url: `/exam/questions/delete-list?ids=${ids.join(',')}` })
  },

  // 导出考试题库 Excel
  exportQuestions: async (params) => {
    return await request.download({ url: `/exam/questions/export-excel`, params })
  },
}